home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / checkbox / scripts / network_test < prev    next >
Encoding:
Text File  |  2009-04-27  |  451 b   |  26 lines

  1. #!/usr/bin/python
  2.  
  3. import os
  4. import re
  5. import sys
  6.  
  7.  
  8. def main(args):
  9.     devices = []
  10.     command = "lspci"
  11.     for line in os.popen(command).readlines():
  12.         match = re.match("^.*(Network|Ethernet) controller: (.*)", line)
  13.         if match:
  14.             devices.append(match.group(2))
  15.  
  16.     if devices:
  17.         print "\n".join(devices)
  18.     else:
  19.         print "Not found."
  20.  
  21.     return 0
  22.  
  23.  
  24. if __name__ == "__main__":
  25.     sys.exit(main(sys.argv[1:]))
  26.